<?php
if (!defined('APP_ID')) { die('No direct script access allowed'); }

class Database_Query_Mysql_Select extends Database_Query_Mysql {
	
	private $_table = '';
	private $_where = '';
	private $_fields = '*';

	public function table($table) {
		$this->_table = $table;
		return $this;
	}

	public function fields($fields) {
		$this->_fields = $fields;
		return $this;
	}

	public function where($where) {
		$this->_where = $where;
		return $this;
	}

	public function compile() {
		$sql = "SELECT " . $this->_fields . ' FROM `' . $this->_table . "`";

		if (!empty($this->_where)) {
			$sql .= " WHERE (" . $this->_where . ")";
		}
		
		return $sql;
	}
	
}
